package com.lnb.system.manager.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lnb.common.request.PageRequest;
import com.lnb.common.result.PageResult;
import com.lnb.system.entity.User;
import com.lnb.system.manager.UserManager;
import com.lnb.system.service.UserService;
import com.lnb.system.vo.UserVO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserManagerImpl implements UserManager {
    @Resource
    private UserService userService;

    @Override
    public PageResult<UserVO> pageList(PageRequest<Object> pageRequest) {
        Page<User> page = userService.pageList(pageRequest);
        List<User> records = page.getRecords();
        return PageResult.result(BeanUtil.copyToList(records, UserVO.class), page, pageRequest);
    }
}
